package com.example.Base;

import android.content.Context;
import android.widget.Toast;

import com.example.tools.MyProgressBar;

import net.tsz.afinal.FinalHttp;

/**
 * Created by Administrator on 2016/9/26.
 */
public class BaseService {
    private Context context;
    protected MyProgressBar mPbar;
    protected FinalHttp mFinalHttp;
    private static Toast mToast = null;

    public BaseService(Context context) {
        this.context = context;
        mPbar = new MyProgressBar(context);
        mFinalHttp = new FinalHttp();
        mFinalHttp.configTimeout(30000);
    }

    /**
     * 显示Toast提示
     */
    protected void showToast(String text) {
        if (mToast == null) {
            mToast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(text);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }
}
